def build(bld):
  hooks = '''shell_hook rawfile_hook gnuplot_hook data_hook cv_hook
             probe_hook charge_deposit_hook vtk_hook cgns_hook mob_monitor_hook ddm_monitor_hook eigenvalue_hook
             singularvalue_hook lsmonitor_hook spice_monitor_hook ksp_convergence_hook current_conservation_hook
             particle_capture_g4_hook particle_capture_data_hook
             particle_capture_analytic_hook particle_capture_1d_hook
             interface_current_hook fg_qf_hook
             particle_monitor_hook gummel_monitor_hook surface_recombination_hook tunneling_hook
             threshold_hook'''.split()

  common_src = ['dlhook.cc']
  if bld.env.PLATFORM == 'Windows':
    for h in hooks: common_src.append('%s.cc' % h)
  if bld.env.PLATFORM == 'AIX':
    for h in hooks: common_src.append('%s.cc' % h)

  bld.objects( source = common_src,
               includes = bld.genius_includes,
               features = 'cxx',
               use      = 'opt SLEPC PETSC CGNS VTK',
               target = 'hook_common',
             )

  if bld.env.PLATFORM == 'Linux': # linux platform support hook dll
    for h in hooks:
      fout = bld.path.find_or_declare(bld.env.cxxshlib_PATTERN % h)

      bld.shlib( source = bld.path.ant_glob('%s.cc' % h),
                 includes  = bld.genius_includes,
                 features  = 'cxx',
                 use       = 'opt hook_common PETSC CGNS VTK AMS',
                 target    = fout,
               )
